package edu.xlh.travel.controller;

import edu.xlh.travel.common.Result;
import edu.xlh.travel.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;

@Controller
@RequestMapping("/fore_hotel")
public class ForeHotelController {
    @Autowired
    private HotelService hotelService;

    /*
     * search attrs by name
     * */
    @RequestMapping("/search_attrs")
    public String search_attrs(Model model, @RequestParam(value = "start" ,defaultValue = "0")Integer start,
                               @RequestParam(value = "limit" ,defaultValue = "6")Integer limit,
                               @RequestParam String search_key) {
        return hotelService.findAll(model , start , limit , search_key);
    }

    /*
     * search scenic detail by id
     * */
    @RequestMapping("/oneAttr")
    public String oneAttr(Model model , String id) {
        return hotelService.findById(model , id);
    }

}
